<?php

namespace common\models;

use Yii;

/**
 * This is the model class for table "school".
 *
 * @property int $ID ID
 * @property string $DM 代码
 * @property string $ZWMC 中文名称
 * @property string $YWMC 英文名称
 * @property string $JC 简称
 * @property string $DZ 地址
 * @property string $DZDM 地址代码
 * @property string $CS 城市
 * @property string $QX 区/县
 * @property string $SDJYBMDM 属地教育部门代码
 * @property string $SDJYBMMC 属地教育部门名称
 * @property string $XZQHM 行政区划码
 * @property string $ZDCXLX 驻地城乡类型
 * @property string $JBZMC 举办者名称
 * @property string $BXLB 办学类别
 * @property int $SSMZXX 独立设置少数民族学校
 * @property string $XXLB 学校类别
 * @property string $FSBLX 附设班类型
 * @property string $FRZSH 法人证书号
 * @property string $FRDBMC 法人代表名称
 * @property string $FZRXM 负责人姓名
 * @property string $FZRLXDH 负责人联系电话
 * @property string $JXNY 建校年月
 * @property string $LXDH 联系电话
 * @property string $CZDH 传真电话
 * @property string $ZYDZ 主页地址
 * @property string $YZBM 邮政编码
 * @property string $DZXX 电子信箱
 * @property string $PGLX 评估类型
 * @property string $SFJLXYW 是否建立校园网
 * @property string $ZGLB 主管类别
 * @property string $XXBB 学校办别
 * @property string $SZDQLB 所在地区类别
 * @property string $XZXM 校长姓名
 * @property string $XZSJH 校长手机号码
 * @property string $XJLXR 学籍联系人
 * @property string $XJLXDH 学籍联系电话
 * @property string $ZSZXDH 招生咨询电话
 * @property string $ZSZXYX 招生咨询邮箱
 * @property string|null $JJ 简介
 * @property string $ZT 状态
 *
 * @property Campus[] $campuses
 * @property Course[] $courses
 * @property Department[] $departments
 * @property GraduationAudit[] $graduationAudits
 * @property Major[] $majors
 * @property SchoolCertificate[] $schoolCertificates
 * @property Student[] $students
 * @property Teacher[] $teachers
 * @property Term[] $terms
 */
class School extends \yii\db\ActiveRecord
{
    /**
     * {@inheritdoc}
     */
    public static function tableName()
    {
        return 'school';
    }

    /**
     * {@inheritdoc}
     */
    public function rules()
    {
        return [
            [['DM', 'ZWMC', 'YWMC', 'JC', 'DZ', 'DZDM', 'CS', 'QX', 'SDJYBMDM', 'SDJYBMMC', 'XZQHM', 'ZDCXLX', 'JBZMC', 'BXLB', 'SSMZXX', 'XXLB', 'FSBLX', 'FRZSH', 'FRDBMC', 'FZRXM', 'FZRLXDH', 'JXNY', 'LXDH', 'CZDH', 'ZYDZ', 'YZBM', 'DZXX', 'PGLX', 'SFJLXYW', 'ZGLB', 'XXBB', 'SZDQLB', 'XZXM', 'XZSJH', 'XJLXR', 'XJLXDH', 'ZSZXDH', 'ZSZXYX', 'ZT'], 'required'],
            [['SSMZXX'], 'integer'],
            [['JXNY'], 'safe'],
            [['JJ'], 'string'],
            [['DM', 'SDJYBMMC', 'JBZMC', 'FRDBMC', 'FZRXM', 'DZXX', 'XZXM', 'XJLXR', 'ZSZXYX'], 'string', 'max' => 50],
            [['ZWMC', 'YWMC', 'ZYDZ'], 'string', 'max' => 100],
            [['JC', 'SDJYBMDM', 'FRZSH', 'FZRLXDH', 'LXDH', 'CZDH', 'PGLX', 'XZSJH', 'XJLXDH', 'ZSZXDH'], 'string', 'max' => 20],
            [['DZ'], 'string', 'max' => 200],
            [['DZDM', 'XZQHM'], 'string', 'max' => 12],
            [['CS', 'QX', 'ZDCXLX', 'BXLB', 'XXLB', 'FSBLX', 'SFJLXYW', 'ZGLB', 'XXBB', 'SZDQLB', 'ZT'], 'string', 'max' => 10],
            [['YZBM'], 'string', 'max' => 6],
        ];
    }

    /**
     * {@inheritdoc}
     */
    public function attributeLabels()
    {
        return [
            'ID' => 'ID',
            'DM' => '代码',
            'ZWMC' => '中文名称',
            'YWMC' => '英文名称',
            'JC' => '简称',
            'DZ' => '地址',
            'DZDM' => '地址代码',
            'CS' => '城市',
            'QX' => '区/县',
            'SDJYBMDM' => '属地教育部门代码',
            'SDJYBMMC' => '属地教育部门名称',
            'XZQHM' => '行政区划码',
            'ZDCXLX' => '驻地城乡类型',
            'JBZMC' => '举办者名称',
            'BXLB' => '办学类别',
            'SSMZXX' => '独立设置少数民族学校',
            'XXLB' => '学校类别',
            'FSBLX' => '附设班类型',
            'FRZSH' => '法人证书号',
            'FRDBMC' => '法人代表名称',
            'FZRXM' => '负责人姓名',
            'FZRLXDH' => '负责人联系电话',
            'JXNY' => '建校年月',
            'LXDH' => '联系电话',
            'CZDH' => '传真电话',
            'ZYDZ' => '主页地址',
            'YZBM' => '邮政编码',
            'DZXX' => '电子信箱',
            'PGLX' => '评估类型',
            'SFJLXYW' => '是否建立校园网',
            'ZGLB' => '主管类别',
            'XXBB' => '学校办别',
            'SZDQLB' => '所在地区类别',
            'XZXM' => '校长姓名',
            'XZSJH' => '校长手机号码',
            'XJLXR' => '学籍联系人',
            'XJLXDH' => '学籍联系电话',
            'ZSZXDH' => '招生咨询电话',
            'ZSZXYX' => '招生咨询邮箱',
            'JJ' => '简介',
            'ZT' => '状态',
        ];
    }

    /**
     * Gets query for [[Campuses]].
     *
     * @return \yii\db\ActiveQuery
     */
    public function getCampuses()
    {
        return $this->hasMany(Campus::className(), ['XXID' => 'ID'])->inverseOf('xX');
    }

    /**
     * Gets query for [[Courses]].
     *
     * @return \yii\db\ActiveQuery
     */
    public function getCourses()
    {
        return $this->hasMany(Course::className(), ['XXID' => 'ID'])->inverseOf('xX');
    }

    /**
     * Gets query for [[Departments]].
     *
     * @return \yii\db\ActiveQuery
     */
    public function getDepartments()
    {
        return $this->hasMany(Department::className(), ['XXID' => 'ID'])->inverseOf('xX');
    }

    /**
     * Gets query for [[GraduationAudits]].
     *
     * @return \yii\db\ActiveQuery
     */
    public function getGraduationAudits()
    {
        return $this->hasMany(GraduationAudit::className(), ['XXID' => 'ID'])->inverseOf('xX');
    }

    /**
     * Gets query for [[Majors]].
     *
     * @return \yii\db\ActiveQuery
     */
    public function getMajors()
    {
        return $this->hasMany(Major::className(), ['XXID' => 'ID'])->inverseOf('xX');
    }

    /**
     * Gets query for [[SchoolCertificates]].
     *
     * @return \yii\db\ActiveQuery
     */
    public function getSchoolCertificates()
    {
        return $this->hasMany(SchoolCertificate::className(), ['XXID' => 'ID'])->inverseOf('xX');
    }

    /**
     * Gets query for [[Students]].
     *
     * @return \yii\db\ActiveQuery
     */
    public function getStudents()
    {
        return $this->hasMany(Student::className(), ['XXID' => 'ID'])->inverseOf('xX');
    }

    /**
     * Gets query for [[Teachers]].
     *
     * @return \yii\db\ActiveQuery
     */
    public function getTeachers()
    {
        return $this->hasMany(Teacher::className(), ['XXID' => 'ID'])->inverseOf('xX');
    }

    /**
     * Gets query for [[Terms]].
     *
     * @return \yii\db\ActiveQuery
     */
    public function getTerms()
    {
        return $this->hasMany(Term::className(), ['XXID' => 'ID'])->inverseOf('xX');
    }
}
